package com.aaa.config;

import com.aaa.servlet.MyServlet;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.Servlet;
import javax.servlet.ServletRegistration;

/**
 * -*- coding:utf-8 -*-
 *
 * @author 太阳偷渡青山
 * @software IntelliJ IDEA
 * @date 2022/11/16 9:39
 * @Description
 */
@Configuration
public class ServletConfig {

    @Bean
    public ServletRegistrationBean<Servlet> servletRegistration() {
        ServletRegistrationBean<Servlet> servletRegistrationBean = new ServletRegistrationBean<>();
        servletRegistrationBean.setServlet(new MyServlet());
        servletRegistrationBean.setName("myServlet");
        servletRegistrationBean.addUrlMappings("/aaa");
        return servletRegistrationBean;
    }
}
